{% extends "base_documentation.html" %}
{%block title%}
Dokümantasyon kategori tanımlamaları 
{%endblock%}
{%block content%}
<!-- {{x}} -->
{% load doc_custom_filters  %}

 <div id="sidetree" class="sidetree">
 {% if perms.documentation.kategori_olusturma %}
 <a href="/documentation/categories/add/"><small>Kategori Ekle</small></a>
 {% endif %}
 <div id="sidetreecontrol"><a class="collapseclick" href="?#">Tümünü Kapat</a>&nbsp;|&nbsp;<a class="expandclick" href="?#">Tümünü Aç</a></div>
 <div id="treediv">
 {{x|safe}}
 </div>
 </div>
 
 {% if form %}
 <div id="contentdiv">
	<div id="itsthetable"> 
	   
	    
	    <table> 
	       
	    <form action="/documentation/categories/{{cat_id}}/save/" method="post">
	    <caption>Kategori Bilgileri Düzenleme:</caption>
	    <tbody>
	            {{ form.as_table }}
	    <tfoot>  
	    <tr><th>&nbsp;</th>
		<td><input type="submit" value="Kaydet"/></form>{%ifnotequal parent_id "0" %}&nbsp;<a href="/documentation/categories/{{cat_id}}/delete/"><img border="0" src="/media/images/icon_deletelink.gif"/></a>&nbsp;<a href="/documentation/categories/{{cat_id}}/delete/">Sil</a>&nbsp;{%endifnotequal%}
	  	</td>
	  	</tr>
	  	</tfoot>
	  	</tbody>
	  </table>	
	</div>  
</div>
{% endif %}
 {% if saveasform %}
<div id="contentdiv">
	<div id="itsthetable" > 
	   
	    <form action="/documentation/categories/saveas/" method="post">   
	    <table > 
	    
	    <caption>Kategori Oluşturma</caption>
	    <tbody>
                {{saveasform.as_table}} 
	    </tbody>
	    <tfoot>
	     
	   
	    </tfoot>
	    </table>
	    <input type="submit" onclick="this.disabled=true;this.value='Ekliyor..';this.form.submit();" value="Kaydet"/>
	    </form>
	    
	</div>
</div>
{% endif %}
{% if catdeleteform %}
<div id="contentdiv">  
	{% for c in cats %}
	<table>
		<tr>
			<td style="width: 100%;"><ul><li><font style="font-size: 12px;">"{{c.aciklama}}" Kategorisini silmek</u> üzeresiniz.<br> Bağlı belgeler {% if bagli_docs_count %}{{bagli_docs_count}}{% endif %} ve alt-kategoriler bir üst dala taşınsın mı?</font></li></ul></td>
		</tr>
		
	
		<tr>
			<td style="width: 50%;" align="right"><form method="POST" action="/documentation/categories/{{cat_id}}/godelete/?docs_confirmed=1"><input type="submit"  onclick="this.disabled=true;this.value='Siliyor..';this.form.submit();" value="Hepsini Sil"/></form></td>
			<td align="left"><form method="POST" action="/documentation/categories/{{cat_id}}/godelete/?docs_confirmed=0"><input type="submit" onclick="this.disabled=true;this.value='Siliyor..';this.form.submit();" value="Sadece Kategoriyi Sil, Dosyalari Taşı"></form></td>
			<td align="left"><form method="POST" action="/documentation/categories/"><input type="submit" value="Vazgeç"></form></td>
		</tr>
	</table> 	
	{% endfor %}

</div>
{% endif %}
{% if docsdiv %}
 <div id="contentdiv">
        <div id="itsthetable" > 
        <table >    
           <caption>{{cat.aciklama}} Kategorisine ve Alt Dallarına Ait Dosyalar:</caption>
           <thead>
           <th>Sno</th>
           <th>Açıklama</th>
           <th scope="col">Oluşturma Tarih-Saat</th>
           <th scope="col">Oluşturan</th>
           <th scope="col">Ait Olduğu Kategori</th>
           <th><form action="/documentation/categories/{{cat.id}}/docs/addnew/"><input type="submit" value="Ekle"/></form></th>
           </thead>            
           <tbody>
            {% if docs %}
            	 
                  {% for doc in docs %} 
           
             <tr>
                  <td>  {{forloop.counter}}</td>
                  <td> <a href="/documentation/docs/{{doc.id}}/edit/">{{ doc.caption }}</a></td>
                  <td> {{ doc.created_on }} </td>
                  <td> {{doc.created_by|lower|capfirst }}</td>
                  <td> {{ doc.category|lower|capfirst }}</td>
                  {% if doc.document %}
                  <td>{% if perms.documentation.belge_icerik_duzenleme %}<a href="{{ doc.document.url}}" target="_new">{%else%}<a href="{{ doc.document.url|getfileurlaspdf}}" target="_new">{% endif %}Dosyayı İndir</a></td>
                  {%else%}
                  <td><font color="red">İliştirilmiş dosya bulunamadi</font></td>
                  {% endif%}
             </tr>
              	 
                  {% endfor %} 
            {% else %}
              <tr>
                 <td><font color="red">İlgili Kategoride Kayıt Bulunamadı!</font></td>
              </tr>
           
            {% endif %}
            </tbody> 
        </table>    
        {% if msg %}<font color="#CC6633;" align="center"<ul><li>{{msg}}</li></ul></font>{%endif%}
    </div>
    </div>
{% endif %}
{% if docaddform %}
 <div id="contentdiv">	
	<div id="itsthetable" >
                        {% if docaddform.errors %}
                                <p style="color: red;">
                                   Bilgilerinizde hata var.. Lütfen Düzeltin ({{ docaddform.errors }}).
                                </p>
                        {% endif %}
                    	{% if perms.documentation.belge_olusturma %}
                        <form enctype="multipart/form-data" method="POST" action="/documentation/docs/saveas/">
		<table>
		
             <caption>Yeni Belge Oluştur</caption>
             <tbody>
	             <tr><th>Belge Açıklaması :</th><td>{{docaddform.caption}}{% if docaddform.caption.errors %}<small>{{docaddform.caption.errors}}</small>{%endif%}</td></tr>
	             <tr><th>Belge :</th><td>{{docaddform.document}}{% if docaddform.document.errors %}<small>{{docaddform.caption.errors}}</small>{%endif%}</td></tr>
	             <tr><th>Kategori :</th><td>{{docaddform.category}}{%if docaddform.category.errors%}<small>{{docaddform.category.erros}}</small>{%endif%}</td></tr>
	             <tr><th>Etiket :</th>
	             		<td>
	             				{{docaddform.tag}}
	             				
		             				{% if perms.documentation.etiket_olusturma %}
		             					
		             					<a href="javascript:void(0);" onclick="PopupCenter('documentation/tags/manage/', 'myPop1',480,400);"><img src="/media/images/icon_addobj.gif"/></a>
		             				
		             				{%endif%}
		             				
	             				{%if docaddform.tag.errors %}<small>{{docaddform.tag.errors}}</small>{%endif%}
	             		</td>
	             </tr>
	             <tr><th>Yetkili Kullanıcı Grupları :</th><td>{{docaddform.usergroup}}{%if docaddform.usergroup.errors%}<small>{{docaddform.usergroup.erros}}</small>{%endif%}</td></tr>
	             <tr><th>Oluşturan :</th><td>{{docaddform.created_by}}{%if docaddform.created_by.errors%}<small>{{docaddform.created_by.errors}}</small>{%endif%}</td></tr>
			 </tbody>
		
		</table>
		
		<input type="submit"  onclick="this.disabled=true;this.value='Ekliyor..';this.form.submit();" value="Kaydet">
		</form>
                        {% else %}
                        <table>
                        <caption>Yeni&nbsp;Belge&nbsp;Oluştur</caption>
                        <thead><th scope="col">Hata :&nbsp;</th><th>Burada Yeni Belge Oluşturmaya Yetkiniz Yok</th></thead>
                        </table>
                        {%endif %}
                       
	</div>
</div>	
{% endif %}
{% if doceditform %}
 <div id="contentdiv">  
    <div id="itsthetable" >
                        {% if doceditform.errors %}
                                <p style="color: red;">
                                   Bilgilerinizde hata var.. Lütfen Düzeltin ({{ doceditform.errors }}).
                                </p>
                        {% endif %}
        {% if perms.documentation.belge_olusturma %}
                        <form enctype="multipart/form-data" method="POST" action="/documentation/docs/{{doc_id}}/save/">
        <table>
        
             <caption>Belge Düzenle</caption>
             <tbody>
                 <tr><th>Belge Açıklaması :</th><td>{{doceditform.caption}}{% if doceditform.caption.errors %}<small>{{doceditform.caption.errors}}</small>{%endif%}</td></tr>
                 <tr><th>Belge :</th><td>Geçerli&nbsp;:&nbsp;<a href="{{doc_current}}">{{doc_current}}</a><br>{{doceditform.document}}{% if doceditform.document.errors %}<small>{{doceditform.caption.errors}}</small>{%endif%}</td></tr>
                 <tr><th>Kategori :</th><td>{{doceditform.category}}{%if doceditform.category.errors%}<small>{{doceditform.category.erros}}</small>{%endif%}</td></tr>
                 <tr><th>Etiket :</th>
                        <td>
                                {{doceditform.tag}}
                                
                                    {% if perms.documentation.etiket_olusturma %}
                                        
                                        <a href="javascript:void(0);" onclick="PopupCenter('documentation/tags/manage/', 'myPop1',480,400);"><img src="/media/images/icon_addobj.gif"/></a>
                                    
                                    {%endif%}
                                   
                                {%if doceditform.tag.errors %}<small>{{doceditform.tag.errors}}</small>{%endif%}
                        </td>
                 </tr>
                 <tr><th>Yetkili Kullanıcı Grupları :</th><td>{{doceditform.usergroup}}{%if doceditform.usergroup.errors%}<small>{{doceditform.usergroup.erros}}</small>{%endif%}</td></tr>
	             <tr><th>Oluşturan :</th><td>{{doceditform.created_by}}{%if doceditform.created_by.errors%}<small>{{doceditform.created_by.errors}}</small>{%endif%}</td></tr>
             </tbody>
	
        </table>
       </div>
	  
	  <table>
	  	<tr>
		<td><input type="submit"  onclick="this.disabled=true;this.value='Ekliyor..';this.form.submit();" value="Kaydet"></td>
		<td>{% if perms.documentation.etiket_olusturma %}<a href="/documentation/docs/{{doc_id}}/delete/"><img border="0" src="/media/images/icon_deletelink.gif"/>&nbsp;Sil&nbsp;</a>{% endif %}</form>&nbsp;</td>
	  	</tr>
	  </table>	
   		
      </div> 
      {% else %}
                
				<table>
                <caption>Belge&nbsp;Düzenleme</caption>
                <thead><th scope="col">Hata :&nbsp;</th><th>Burada Belge Düzenlemeye Yetkiniz Yok. <a href="javascript:history.back()">Geri</a></th></thead>
                </table>
		</div>
	  </div>	
      {%endif %}
                       

{% endif %}
{% if docdeleteform %}
<div id="contentdiv">  
	{% for doc in doc %}
	<table>
		<tr>
			<td style="width: 100%;"><ul><li><font style="font-size: 12px;">"{{doc.caption}}" başlıklı , <a href="{{doc.document}}">{{doc.document}}</a> dosyasını <u>silmek</u> üzeresiniz. <br>Emin misiniz?</font></li></ul></td>
		</tr>
	
	
		<tr>
			<td style="width: 50%;" align="right"><form method="POST" action="/documentation/docs/{{doc_id}}/godelete/"><input type="submit"  onclick="this.disabled=true;this.value='Siliyor..';this.form.submit();" value="Şimdi Sil"/></form></td>
			<td align="left"><form method="POST" action="/documentation/categories/{{doc.category_id}}/docs/?msg=4"/><input type="submit" value="Vazgeç"></form></td>
		</tr>
	</table> 	
	{% endfor %}

</div>

{% endif %}
<!-- 
-->
{%endblock%}
{%block script%}
<link rel="stylesheet" href="/media/css/jquery.treeview.css" />
<script src="/media/js/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript" src="/media/js/jquery.treeview.js"></script>
<script type="text/javascript">
		$(function() {

			$("#tree").treeview({
				collapsed: true,
				control:"#sidetreecontrol"
				
				
				
			});

			

		})
		
		$(document).ready(function() { 
			$('a.expandclick').click();
		});
		
</script>
<script>
function PopupCenter(pageURL, title,w,h) {
	var mydomain=window.location.href.match(/:\/\/(.[^/]+)/)[1];
	//alert(mydomain);
	var pageURL="http://"+mydomain+"/"+pageURL;
	//alert("2 : "+pageURL);
	
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);

}
</script>
<link rel="stylesheet" type="text/css" href="/media/css/table-orange.css" />
{%endblock%}
